package com.file.system.entity.system;


import com.file.system.entity.basic.WebBasic;
import com.file.system.plugin.dict.Dict;
import com.file.system.plugin.validated.SQLInjectionValidation;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.*;
import javax.validation.groups.Default;
import java.io.Serializable;


/**
* 岗位
*
* @author jch
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class WebPost extends WebBasic implements Serializable{

    private static final long serialVersionUID = 1L;


    //新增
    public interface add extends Default{
    }

    //修改
    public interface update extends Default{
    }

    /**
    * 主键
    */
    @NotNull(groups = {update.class}, message = "主键不能为空")
    @Min( value = 1, message = "id长度最小1")
    private Long id;
    /**
    * 岗位名称
    */
    @NotEmpty(groups = {update.class,add.class}, message = "岗位名称不能为空")
    @Size(min = 1, max = 30, message = "岗位名称长度1-30")
    @SQLInjectionValidation(fieldName = "岗位名称")
    private String name;
    /**
    * 岗位编码
    */
    @NotEmpty(groups = {update.class,add.class}, message = "岗位编码不能为空")
    @Size(min = 1, max = 20, message = "岗位编码长度1-20")
    @SQLInjectionValidation(fieldName = "岗位编码")
    private String code;
    /**
    * 排序
    */
    @NotNull(groups = {add.class, update.class}, message = "排序不能为空")
    @Min(value = 1, message = "排序最小1")
    @Max(value = 2000, message = "排序最大2000")
    private Integer sort;
    /**
    * 0启用1禁用（字典）
    */
    @NotEmpty(groups = {update.class,add.class}, message = "0启用1禁用不能为空")
    @Size(min = 1, max = 1, message = "0启用1禁用长度1-1")
    @Dict("onOff")
    @SQLInjectionValidation(fieldName = "0启用1禁用")
    private String dictOnOff;
    /**
    * 备注
    */
    @NotEmpty(groups = {update.class,add.class}, message = "备注不能为空")
    @Size(min = 1, max = 500, message = "备注长度1-500")
    @SQLInjectionValidation(fieldName = "备注")
    private String description;
}
